package com.ricky.config;

import com.netflix.client.config.IClientConfig;
import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by baiguantao on 2017/10/26.
 *
 * 自定义负载规则
 */
@Configuration
public class RibbonConfig {
    @Autowired
    IClientConfig config;
/*
    @Bean
    public IPing ribbonPing(IClientConfig config) {
        return new PingUrl();
    }*/
/*
    @Bean
    public IRule ribbonRule(IClientConfig config) {
        return new AvailabilityFilteringRule();
    }*/
    @Bean
    public IRule ribbonRule(IClientConfig config) {
        return new RandomRule();
    }
}
